package com.wang.JinDong2;

import java.util.Scanner;

/**
 * 卖家模块
 */
public class Seller implements LogIn,Checking {
    static Scanner input = new Scanner(System.in);
    final String sellerName="longbaosell";
    final String passWord="********";
    final String profitPassWord= "123123";

    static int waitBuyerPay = 0;
    static int buyerPaid =0;
    static int profit = 0;
    @Override
    public boolean logIn() {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入你的用户名：");
        String sellerName = input.nextLine();
        System.out.print("请输入你的密码：");
        String passWord = input.nextLine();
        return check(sellerName,passWord);
    }
    public boolean check(String sellerName, String passWord) {
        if(this.sellerName.equals(sellerName)&&this.passWord.equals(passWord)){
            return true;
        }
        return false;
    }

    public static void addProduct(){
        System.out.println("请输入产品编号");
        int id = input.nextInt();
        for(Product p :Store.list){
            if(p.getId()==id){
                System.out.println("此编号商品已经存在，请重新添加");
                Pause.pause();
                return;
            }
        }
        System.out.println("请输入产品名称");
        String name = input.next();
        System.out.println("请输入产品价格");
        int price = input.nextInt();
        System.out.println("请输入产品颜色");
        String color = input.next();
        System.out.println("请输入产品尺寸");
        int size =input.nextInt();
        System.out.println("请输入产品库存");
        int store = input.nextInt();
        Store.add(id,name,price,color,size,store);
        System.out.println("添加成功");
        Pause.pause();
    }
    public static void deleteProduct(int id){
        if(Store.list.size()==0){
            System.out.println("当前无任何产品，无法删除");
            Pause.pause();
            return;
        }else {
            for(Product p :Store.list){
                if(p.getId()==id){
                    Store.list.remove(p);
                    System.out.println("删除成功");
                    Pause.pause();
                    return;
                }
            }
        }
        System.out.println("未找到此编号的产品");
        Pause.pause();
    }

    public static void checkProfit(){
        System.out.println("当前收益为："+profit);
    }


}
